import * as type from './mutation-types'
export const state = {
    status: -9999,
    errmsg: '',
    sv2FaqInfo: {},
    sv2fLoading: '',
    v2FaqList: {},
    v2fLoading: '',
    dv2FaqInfo: {},
    dv2fLoading: '',
    v2CondList: {},
    v2cLoading: '',
    v2DragInfo: {},
    v2dLoading: '',
    v2parentsList: {},
    v2pLoading: '',
    v2FULoading: '',
    v2FaqUserList: {},
    v2FormList: {},
    v2FormLoading: '',
    formInfo: {},
    formInfoLoading: '',
    v2ToFe: {},
    v2ToFeStatus: '',
    messagePushInfo: {},
    messagePushLoading: '',
    // 补充工单 uniqueId 信息
    addUniqueIdInfo: {},
    addUniqueIdStatus: '',
    // 下载批量创建 Excel 模版
    batchTemplateInfo: {},
    batchTemplateStatus: '',
}
export const mutations = {
    //登录
    [type.SETV2FAQ_REQUEST](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = (res && res.code) || -9999
        state.sv2FaqInfo = {}
        state.sv2fLoading = 'loading'
    },
    [type.SETV2FAQ_RECEIVE](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = res.code
        state.sv2FaqInfo = (res && res.content) || {}
        state.sv2fLoading = state.status > -9999 && 'loaded'
    },
    //登录
    [type.GETV2FAQ_REQUEST](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = (res && res.code) || -9999
        state.v2FaqList = {}
        state.v2fLoading = 'loading'
    },
    [type.GETV2FAQ_RECEIVE](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = res.code
        state.v2FaqList = (res && res.content) || {}
        state.v2fLoading = state.status > -9999 && 'loaded'
    },
    //登录
    [type.DELV2FAQ_REQUEST](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = (res && res.code) || -9999
        state.dv2FaqInfo = {}
        state.dv2fLoading = 'loading'
    },
    [type.DELV2FAQ_RECEIVE](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = res.code
        state.dv2FaqInfo = (res && res.content) || {}
        state.dv2fLoading = state.status > -9999 && 'loaded'
    },
    //登录
    [type.GETV2FAQCOND_REQUEST](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = (res && res.code) || -9999
        state.v2CondList = {}
        state.v2cLoading = 'loading'
    },
    [type.GETV2FAQCOND_RECEIVE](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = res.code
        state.v2CondList = (res && res.content) || {}
        state.v2cLoading = state.status > -9999 && 'loaded'
    },
    //登录
    [type.DRAGV2FAQ_REQUEST](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = (res && res.code) || -9999
        state.v2DragInfo = {}
        state.v2dLoading = 'loading'
    },
    [type.DRAGV2FAQ_RECEIVE](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = res.code
        state.v2DragInfo = (res && res.content) || {}
        state.v2dLoading = state.status > -9999 && 'loaded'
    },
    //登录
    [type.GETV2FAQPARENTS_REQUEST](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = (res && res.code) || -9999
        state.v2parentsList = {}
        state.v2pLoading = 'loading'
    },
    [type.GETV2FAQPARENTS_RECEIVE](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = res.code
        state.v2parentsList = (res && res.content) || {}
        state.v2pLoading = state.status > -9999 && 'loaded'
    },
    //登录
    [type.GETV2FORMLIST_REQUEST](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = (res && res.code) || -9999
        state.v2FormList = {}
        state.v2FormLoading = 'loading'
    },
    [type.GETV2FORMLIST_RECEIVE](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = res.code
        state.v2FormList = (res && res.content) || {}
        state.v2FormLoading = state.status > -9999 && 'loaded'
    },
    //登录
    [type.GETV2FAQULIST_REQUEST](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = (res && res.code) || -9999
        state.v2FaqUserList = {}
        state.v2FULoading = 'loading'
    },
    [type.GETV2FAQULIST_RECEIVE](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = res.code
        state.v2FaqUserList = (res && res.content) || {}
        state.v2FULoading = state.status > -9999 && 'loaded'
    },
    //登录
    [type.SUBMITFEMSG_REQUEST](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = (res && res.code) || -9999
        state.v2ToFe = {}
        state.v2ToFeStatus = 'stating'
    },
    [type.SUBMITFEMSG_RECEIVE](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = res.code
        state.v2ToFe = (res && res.content) || {}
        state.v2ToFeStatus = state.status > -9999 && 'stated'
    },
    //表单详情
    [type.FORMINFO_REQUEST](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = (res && res.code) || -9999
        state.formInfo = {}
        state.formInfoLoading = 'loading'
    },
    [type.FORMINFO_RECEIVE](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = res.code
        state.formInfo = (res && res.content) || {}
        state.formInfoLoading = state.status > -9999 && 'loaded'
    },
    //消息推送
    [type.MESSAGEPUSH_REQUEST](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = (res && res.code) || -9999
        state.messagePushInfo = {}
        state.messagePushLoading = 'loading'
    },
    [type.MESSAGEPUSH_RECEIVE](state, res) {
        state.errmsg = (res && res.reason) || ''
        state.status = res.code
        state.messagePushInfo = res || {}
        state.messagePushLoading = state.status > -9999 && 'loaded'
    },
    // 补充工单 uniqueId 信息
    [type.ADDUNIQUEID_REQUEST](state) {
        state.addUniqueIdStatus = 'loading';
        state.addUniqueIdInfo = {};
    },
    [type.ADDUNIQUEID_RECEIVE](state, res) {
        state.addUniqueIdStatus = 'loaded';
        state.addUniqueIdInfo = res?.content || {};
    },
    // 下载批量创建 Excel 模版
    [type.BATCHTEMPLATE_REQUEST](state) {
        state.batchTemplateStatus = 'loading';
        state.batchTemplateInfo = {};
    },
    [type.BATCHTEMPLATE_RECEIVE](state, res) {
        state.batchTemplateStatus = 'loaded';
        state.batchTemplateInfo = res?.content || {};
    },
}